package com.arpa.wms.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 预打包单
 * </p>
 *
 * @author leo
 * @since 2021-07-02
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_prepackaged")
@ApiModel(value="Prepackaged对象", description="预打包单")
public class Prepackaged extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "预打包计划号")
    @TableField("code")
    @NotEmpty(message = "数据标识不能为空", groups = Update.class)
    private String code;

    @ApiModelProperty(value = "仓库标识")
    @TableField("warehouse_code")
    private String warehouseCode;

    @ApiModelProperty(value = "仓库名称")
    @TableField("warehouse_name")
    private String warehouseName;

    @ApiModelProperty(value = "货主code")
    @TableField("shipment_code")
    private String shipmentCode;

    @ApiModelProperty(value = "货主名称")
    @TableField("shipment_name")
    private String shipmentName;

    @ApiModelProperty(value = "所属机构code")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "来源单号，如：oms预播单号,暂时为空不维护")
    @TableField("source_code")
    @Length(max = 100, message = "来源单号长度不能大于100个字符", groups = {Save.class, Update.class})
    private String sourceCode;

    @ApiModelProperty(value = "包裹数量")
    @TableField("package_quantity")
    @Digits(integer = 11,fraction = 0, groups = {Save.class, Update.class})
    private Integer packageQuantity;

    @ApiModelProperty(value = "单包裹商品种数")
    @TableField("type_quantity")
    private Integer typeQuantity;

    @ApiModelProperty(value = "商品总数")
    @TableField("total_quantity")
    @Digits(integer = 20,fraction = 6,groups = {Save.class, Update.class})
    private BigDecimal totalQuantity;

    @ApiModelProperty(value = "打包任务是否下发：0否，1是")
    @TableField("is_issue")
    private Integer issue;

    @ApiModelProperty(value = "下发包裹总数")
    @TableField("issue_quantity")
    private Integer issueQuantity;

    @ApiModelProperty(value = "已打包包裹总数")
    @TableField("pack_quantity")
    private Integer packQuantity;

    @ApiModelProperty(value = "已拣包裹总数")
    @TableField("picking_quantity")
    private Integer pickingQuantity;

    @ApiModelProperty(value = "状态,0-新增。1-待分配，2-部分分配，3-待拣货，4-拣货完成，5-打包完成")
    @TableField("status")
    private String status;

    @ApiModelProperty(value = "版本号,做乐观锁")
    @TableField("version")
    @Version
    private Integer version;

    @ApiModelProperty(value = "出货单明细列表")
    @TableField(exist = false)
    @Valid
    private List<PrepackagedItem> prepackagedItemList;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 100, message = "备注长度不能大于100个字符", groups = {Save.class, Update.class})
    private String remarks;

    @ApiModelProperty(value = "分配数量")
    @TableField("distribution_quantity")
    private BigDecimal distributionQuantity;

    @ApiModelProperty(value = "明细单包裹组合数量之和")
    @TableField("total_combination_quantity")
    private BigDecimal totalCombinationQuantity;

    @ApiModelProperty(value = "分配包裹数量")
    @TableField("distribution_pack_quantity")
    private Integer distributionPackQuantity;

    public interface Save{}
    public interface Update{}


}
